define(function () {    
    var ec=require('echarts');
    require('echarts/chart/eventRiver'); 
 
    var myChart = ec.init(document.getElementById('entword_event'));
    
 var option = {
    title : {
        text: '招聘职位热搜词'
    },
    tooltip : {
        trigger: 'item',
        enterable: true
    },
    legend: {
        data:['第一周','第二周']
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    xAxis : [
        {
            type : 'time',
            boundaryGap: [0.05,0.1]
        }
    ],
    series : [
        {
            "name": "第一周", 
            "type": "eventRiver", 
            "weight": 123, 
            "data": []
        },
        {
            "name": "第二周", 
            "type": "eventRiver", 
            "weight": 123, 
            "data": []
        }  
    ]
};
                 
    /**
     * 根据指标显示日数据
     * @param index
     */
    function show(){
    
 
		var beginDate = $('#beginDate_entword').val();
		 
		var city_option = $('#city_entword_option').val();
		var cate_option = $('#cate_entword_option').val();		

        myChart.showLoading({
            text: '正在努力的读取数据中...'
        });
	
	    $.ajax({
	        	url: '/dashboard/resume/ajax/getResumeEntWord',
	        	type: 'POST',
	       		async: true,
	        	data:{"city_option":city_option,"cate_option":cate_option,"beginDate":beginDate},
	        	dataType: 'json',
	         	success: function(data, textStatus) {

	         		option.series[0].data = data.datalist[0];
	         		option.series[1].data = data.datalist[1];
	         		
	         		myChart.setOption(option,true);
	         		myChart.hideLoading();
	                    
		       },
	             timeout: 5000,
	             error: function() {
	                  myChart.hideLoading();
	             }
	          });   
    }

   
    //时间选择事件
    $('#beginDate_entword').datepicker(datepicker_op);

    var EC={
        echart:myChart,
        resize:function()
        	{
        		//myChart.resize();
        	},
        'show':show
    };

    //绑定刷新
    $("#refresh_entword_btn").click(function(){
        EC.show();
    });
    EC.show();
    return EC;
});